#define _CRT_SECURE_NO_WARNINGS 1

#include"SList.h"
Listnode* reverseBetween(Listnode* head, int left, int right) {
    Listnode* pdiyi = head;
    Listnode* pqian = head;
    Listnode* prev = head;
    Listnode* pcur = head;
    Listnode* pnext = head->next;

    int tmple = left;
    while (--tmple)
    {
        prev = pcur;
        pnext = pnext->next;
        pcur = pcur->next;
    }
    pqian = prev;
    pdiyi = pcur;
    int cha = right - left;
    while (cha-- && pnext)
    {
        pcur->next = prev;
        prev = pcur;
        pcur = pnext;
        pnext = pnext->next;
    }
    pdiyi->next = pnext;
    pqian->next = pcur;

    return head;
}
int main()
{
	Listnode* p = NULL;
	Listpushback(&p, 5);
    reverseBetween(p, 1, 1);
    Listprint(p);
	return 0;
}